home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / outlndrg / otln_drg.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-07  |  2.0 KB  |  61 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Sample of Dragging from the Outline control to a List box"
  4.    ClientHeight    =   4020
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1485
  7.    ClientWidth     =   7365
  8.    Height          =   4425
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4020
  12.    ScaleWidth      =   7365
  13.    Top             =   1140
  14.    Width           =   7485
  15.    Begin ListBox List1 
  16.       Height          =   1590
  17.       Left            =   4440
  18.       TabIndex        =   1
  19.       Top             =   960
  20.       Width           =   1815
  21.    End
  22.    Begin PictureBox Outline1 
  23.       Height          =   2295
  24.       Left            =   1320
  25.       ScaleHeight     =   2265
  26.       ScaleWidth      =   2385
  27.       TabIndex        =   0
  28.       Top             =   720
  29.       Width           =   2415
  30.    End
  31.    Begin Label Label1 
  32.       Caption         =   "This sample is designed to only allow the folders that don't have subitems to be dropped in the List box control."
  33.       Height          =   375
  34.       Left            =   1320
  35.       TabIndex        =   2
  36.       Top             =   120
  37.       Width           =   5055
  38.    End
  39. Sub Form_Load ()
  40.      For i = 0 To 4
  41.          ' Note that item 0 will not be visible, by design.
  42.          outline1.AddItem "Item # " + Str$(i)
  43.          outline1.Indent(i) = i
  44.       Next
  45.       For i = 1 To 4
  46.          outline1.Expand(i - 1) = True
  47.       Next
  48.       ' Add the following statement to work around a known bug
  49.        outline1.ListIndex = 1
  50. End Sub
  51. Sub List1_DragDrop (Source As Control, X As Single, Y As Single)
  52. outline1.Drag 0
  53. If outline1.HasSubItems(outline1.ListIndex) = False Then  'no parents, only leaves
  54.  list1.AddItem outline1.List(outline1.ListIndex)
  55.  MsgBox "Sorry this folder has a subitem"
  56. End If
  57. End Sub
  58. Sub Outline1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  59.  outline1.Drag 1
  60. End Sub
  61.